<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Django documentation &mdash; Django 1.7.8.dev20150401230226 documentation</title>
    
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '1.7.8.dev20150401230226',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="Django 1.7.8.dev20150401230226 documentation" href="#" />
    <link rel="next" title="Getting started" href="intro/index.html" />
    <link rel="prev" title="Django documentation contents" href="contents.html" />



 
<script type="text/javascript" src="templatebuiltins.js"></script>
<script type="text/javascript">
(function($) {
    if (!django_template_builtins) {
       // templatebuiltins.js missing, do nothing.
       return;
    }
    $(document).ready(function() {
        // Hyperlink Django template tags and filters
        var base = "ref/templates/builtins.html";
        if (base == "#") {
            // Special case for builtins.html itself
            base = "";
        }
        // Tags are keywords, class '.k'
        $("div.highlight\\-html\\+django span.k").each(function(i, elem) {
             var tagname = $(elem).text();
             if ($.inArray(tagname, django_template_builtins.ttags) != -1) {
                 var fragment = tagname.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + tagname + "</a>");
             }
        });
        // Filters are functions, class '.nf'
        $("div.highlight\\-html\\+django span.nf").each(function(i, elem) {
             var filtername = $(elem).text();
             if ($.inArray(filtername, django_template_builtins.tfilters) != -1) {
                 var fragment = filtername.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + filtername + "</a>");
             }
        });
    });
})(jQuery);
</script>


  </head>
  <body>

    <div class="document">
  <div id="custom-doc" class="">
    <div id="hd">
      <h1><a href="#">Django 1.7.8.dev20150401230226 documentation</a></h1>
      <div id="global-nav">
        <a title="Home page" href="#">Home</a>  |
        <a title="Table of contents" href="contents.html">Table of contents</a>  |
        <a title="Global index" href="genindex.html">Index</a>  |
        <a title="Module index" href="py-modindex.html">Modules</a>
      </div>
      <div class="nav">
    &laquo; <a href="contents.html" title="Django documentation contents">previous</a>
     |
    <a title="Django 1.7.8.dev20150401230226 documentation" href="#" accesskey="U">up</a>
   |
    <a href="intro/index.html" title="Getting started">next</a> &raquo;</div>
    </div>

    <div id="bd">
      <div id="yui-main">
        <div class="yui-b">
          <div class="yui-g" id="index">
            
  <div class="section" id="s-django-documentation">
<span id="s-index"></span><span id="django-documentation"></span><span id="index"></span><h1>Django documentation<a class="headerlink" href="#django-documentation" title="Permalink to this headline">¶</a></h1>
<p class="rubric">Everything you need to know about Django.</p>
<div class="section" id="s-getting-help">
<span id="getting-help"></span><h2>Getting help<a class="headerlink" href="#getting-help" title="Permalink to this headline">¶</a></h2>
<p>Having trouble? We&#8217;d like to help!</p>
<ul class="simple">
<li>Try the <a class="reference internal" href="faq/index.html"><em>FAQ</em></a> &#8211; it&#8217;s got answers to many common questions.</li>
<li>Looking for specific information? Try the <a class="reference internal" href="genindex.html"><em>Index</em></a>, <a class="reference internal" href="py-modindex.html"><em>Module Index</em></a> or
the <a class="reference internal" href="contents.html"><em>detailed table of contents</em></a>.</li>
<li>Search for information in the archives of the <a class="reference internal" href="internals/mailing-lists.html#django-users-mailing-list"><em>django-users</em></a> mailing list, or
<a class="reference external" href="https://groups.google.com/d/forum/django-users">post a question</a>.</li>
<li>Ask a question in the <a class="reference external" href="irc://irc.freenode.net/django">#django IRC channel</a>, or search the <a class="reference external" href="http://django-irc-logs.com/">IRC logs</a> to see
if it&#8217;s been asked before.</li>
<li>Report bugs with Django in our <a class="reference external" href="https://code.djangoproject.com/">ticket tracker</a>.</li>
</ul>
</div>
<div class="section" id="s-first-steps">
<span id="first-steps"></span><h2>First steps<a class="headerlink" href="#first-steps" title="Permalink to this headline">¶</a></h2>
<p>Are you new to Django or to programming? This is the place to start!</p>
<ul class="simple">
<li><strong>From scratch:</strong>
<a class="reference internal" href="intro/overview.html"><em>Overview</em></a> |
<a class="reference internal" href="intro/install.html"><em>Installation</em></a></li>
<li><strong>Tutorial:</strong>
<a class="reference internal" href="intro/tutorial01.html"><em>Part 1: Models</em></a> |
<a class="reference internal" href="intro/tutorial02.html"><em>Part 2: The admin site</em></a> |
<a class="reference internal" href="intro/tutorial03.html"><em>Part 3: Views and templates</em></a> |
<a class="reference internal" href="intro/tutorial04.html"><em>Part 4: Forms and generic views</em></a> |
<a class="reference internal" href="intro/tutorial05.html"><em>Part 5: Testing</em></a> |
<a class="reference internal" href="intro/tutorial06.html"><em>Part 6: Static files</em></a></li>
<li><strong>Advanced Tutorials:</strong>
<a class="reference internal" href="intro/reusable-apps.html"><em>How to write reusable apps</em></a> |
<a class="reference internal" href="intro/contributing.html"><em>Writing your first patch for Django</em></a></li>
</ul>
</div>
<div class="section" id="s-the-model-layer">
<span id="the-model-layer"></span><h2>The model layer<a class="headerlink" href="#the-model-layer" title="Permalink to this headline">¶</a></h2>
<p>Django provides an abstraction layer (the &#8220;models&#8221;) for structuring and
manipulating the data of your Web application. Learn more about it below:</p>
<ul class="simple">
<li><strong>Models:</strong>
<a class="reference internal" href="topics/db/models.html"><em>Model syntax</em></a> |
<a class="reference internal" href="ref/models/fields.html"><em>Field types</em></a> |
<a class="reference internal" href="ref/models/options.html"><em>Meta options</em></a></li>
<li><strong>QuerySets:</strong>
<a class="reference internal" href="topics/db/queries.html"><em>Executing queries</em></a> |
<a class="reference internal" href="ref/models/querysets.html"><em>QuerySet method reference</em></a> |
<a class="reference internal" href="ref/models/queries.html"><em>Query-related classes</em></a> |
<a class="reference internal" href="ref/models/lookups.html"><em>Lookup expressions</em></a></li>
<li><strong>Model instances:</strong>
<a class="reference internal" href="ref/models/instances.html"><em>Instance methods</em></a> |
<a class="reference internal" href="ref/models/relations.html"><em>Accessing related objects</em></a></li>
<li><strong>Migrations:</strong>
<a class="reference internal" href="topics/migrations.html"><em>Introduction to Migrations</em></a> |
<a class="reference internal" href="ref/migration-operations.html"><em>Operations reference</em></a> |
<a class="reference internal" href="ref/schema-editor.html"><em>SchemaEditor</em></a></li>
<li><strong>Advanced:</strong>
<a class="reference internal" href="topics/db/managers.html"><em>Managers</em></a> |
<a class="reference internal" href="topics/db/sql.html"><em>Raw SQL</em></a> |
<a class="reference internal" href="topics/db/transactions.html"><em>Transactions</em></a> |
<a class="reference internal" href="topics/db/aggregation.html"><em>Aggregation</em></a> |
<a class="reference internal" href="howto/custom-model-fields.html"><em>Custom fields</em></a> |
<a class="reference internal" href="topics/db/multi-db.html"><em>Multiple databases</em></a> |
<a class="reference internal" href="howto/custom-lookups.html"><em>Custom lookups</em></a></li>
<li><strong>Other:</strong>
<a class="reference internal" href="ref/databases.html"><em>Supported databases</em></a> |
<a class="reference internal" href="howto/legacy-databases.html"><em>Legacy databases</em></a> |
<a class="reference internal" href="howto/initial-data.html"><em>Providing initial data</em></a> |
<a class="reference internal" href="topics/db/optimization.html"><em>Optimize database access</em></a></li>
</ul>
</div>
<div class="section" id="s-the-view-layer">
<span id="the-view-layer"></span><h2>The view layer<a class="headerlink" href="#the-view-layer" title="Permalink to this headline">¶</a></h2>
<p>Django has the concept of &#8220;views&#8221; to encapsulate the logic responsible for
processing a user&#8217;s request and for returning the response. Find all you need
to know about views via the links below:</p>
<ul class="simple">
<li><strong>The basics:</strong>
<a class="reference internal" href="topics/http/urls.html"><em>URLconfs</em></a> |
<a class="reference internal" href="topics/http/views.html"><em>View functions</em></a> |
<a class="reference internal" href="topics/http/shortcuts.html"><em>Shortcuts</em></a> |
<a class="reference internal" href="topics/http/decorators.html"><em>Decorators</em></a></li>
<li><strong>Reference:</strong>
<a class="reference internal" href="ref/views.html"><em>Built-in Views</em></a> |
<a class="reference internal" href="ref/request-response.html"><em>Request/response objects</em></a> |
<a class="reference internal" href="ref/template-response.html"><em>TemplateResponse objects</em></a></li>
<li><strong>File uploads:</strong>
<a class="reference internal" href="topics/http/file-uploads.html"><em>Overview</em></a> |
<a class="reference internal" href="ref/files/file.html"><em>File objects</em></a> |
<a class="reference internal" href="ref/files/storage.html"><em>Storage API</em></a> |
<a class="reference internal" href="topics/files.html"><em>Managing files</em></a> |
<a class="reference internal" href="howto/custom-file-storage.html"><em>Custom storage</em></a></li>
<li><strong>Class-based views:</strong>
<a class="reference internal" href="topics/class-based-views/index.html"><em>Overview</em></a> |
<a class="reference internal" href="topics/class-based-views/generic-display.html"><em>Built-in display views</em></a> |
<a class="reference internal" href="topics/class-based-views/generic-editing.html"><em>Built-in editing views</em></a> |
<a class="reference internal" href="topics/class-based-views/mixins.html"><em>Using mixins</em></a> |
<a class="reference internal" href="ref/class-based-views/index.html"><em>API reference</em></a> |
<a class="reference internal" href="ref/class-based-views/flattened-index.html"><em>Flattened index</em></a></li>
<li><strong>Advanced:</strong>
<a class="reference internal" href="howto/outputting-csv.html"><em>Generating CSV</em></a> |
<a class="reference internal" href="howto/outputting-pdf.html"><em>Generating PDF</em></a></li>
<li><strong>Middleware:</strong>
<a class="reference internal" href="topics/http/middleware.html"><em>Overview</em></a> |
<a class="reference internal" href="ref/middleware.html"><em>Built-in middleware classes</em></a></li>
</ul>
</div>
<div class="section" id="s-the-template-layer">
<span id="the-template-layer"></span><h2>The template layer<a class="headerlink" href="#the-template-layer" title="Permalink to this headline">¶</a></h2>
<p>The template layer provides a designer-friendly syntax for rendering the
information to be presented to the user. Learn how this syntax can be used by
designers and how it can be extended by programmers:</p>
<ul class="simple">
<li><strong>For designers:</strong>
<a class="reference internal" href="topics/templates.html"><em>Syntax overview</em></a> |
<a class="reference internal" href="ref/templates/builtins.html"><em>Built-in tags and filters</em></a> |
<a class="reference internal" href="ref/contrib/webdesign.html"><em>Web design helpers</em></a> |
<a class="reference internal" href="ref/contrib/humanize.html"><em>Humanization</em></a></li>
<li><strong>For programmers:</strong>
<a class="reference internal" href="ref/templates/api.html"><em>Template API</em></a> |
<a class="reference internal" href="howto/custom-template-tags.html"><em>Custom tags and filters</em></a></li>
</ul>
</div>
<div class="section" id="s-forms">
<span id="forms"></span><h2>Forms<a class="headerlink" href="#forms" title="Permalink to this headline">¶</a></h2>
<p>Django provides a rich framework to facilitate the creation of forms and the
manipulation of form data.</p>
<ul class="simple">
<li><strong>The basics:</strong>
<a class="reference internal" href="topics/forms/index.html"><em>Overview</em></a> |
<a class="reference internal" href="ref/forms/api.html"><em>Form API</em></a> |
<a class="reference internal" href="ref/forms/fields.html"><em>Built-in fields</em></a> |
<a class="reference internal" href="ref/forms/widgets.html"><em>Built-in widgets</em></a></li>
<li><strong>Advanced:</strong>
<a class="reference internal" href="topics/forms/modelforms.html"><em>Forms for models</em></a> |
<a class="reference internal" href="topics/forms/media.html"><em>Integrating media</em></a> |
<a class="reference internal" href="topics/forms/formsets.html"><em>Formsets</em></a> |
<a class="reference internal" href="ref/forms/validation.html"><em>Customizing validation</em></a></li>
<li><strong>Extras:</strong>
<a class="reference internal" href="ref/contrib/formtools/form-preview.html"><em>Form preview</em></a> |
<a class="reference internal" href="ref/contrib/formtools/form-wizard.html"><em>Form wizard</em></a></li>
</ul>
</div>
<div class="section" id="s-the-development-process">
<span id="the-development-process"></span><h2>The development process<a class="headerlink" href="#the-development-process" title="Permalink to this headline">¶</a></h2>
<p>Learn about the various components and tools to help you in the development and
testing of Django applications:</p>
<ul class="simple">
<li><strong>Settings:</strong>
<a class="reference internal" href="topics/settings.html"><em>Overview</em></a> |
<a class="reference internal" href="ref/settings.html"><em>Full list of settings</em></a></li>
<li><strong>Applications:</strong>
<a class="reference internal" href="ref/applications.html"><em>Overview</em></a></li>
<li><strong>Exceptions:</strong>
<a class="reference internal" href="ref/exceptions.html"><em>Overview</em></a></li>
<li><strong>django-admin.py and manage.py:</strong>
<a class="reference internal" href="ref/django-admin.html"><em>Overview</em></a> |
<a class="reference internal" href="howto/custom-management-commands.html"><em>Adding custom commands</em></a></li>
<li><strong>Testing:</strong>
<a class="reference internal" href="topics/testing/index.html"><em>Introduction</em></a> |
<a class="reference internal" href="topics/testing/overview.html"><em>Writing and running tests</em></a> |
<a class="reference internal" href="topics/testing/tools.html"><em>Included testing tools</em></a> |
<a class="reference internal" href="topics/testing/advanced.html"><em>Advanced topics</em></a></li>
<li><strong>Deployment:</strong>
<a class="reference internal" href="howto/deployment/index.html"><em>Overview</em></a> |
<a class="reference internal" href="howto/deployment/wsgi/index.html"><em>WSGI servers</em></a> |
<a class="reference internal" href="howto/deployment/fastcgi.html"><em>FastCGI/SCGI/AJP</em></a> (deprecated) |
<a class="reference internal" href="howto/static-files/deployment.html"><em>Deploying static files</em></a> |
<a class="reference internal" href="howto/error-reporting.html"><em>Tracking code errors by email</em></a></li>
</ul>
</div>
<div class="section" id="s-the-admin">
<span id="the-admin"></span><h2>The admin<a class="headerlink" href="#the-admin" title="Permalink to this headline">¶</a></h2>
<p>Find all you need to know about the automated admin interface, one of Django&#8217;s
most popular features:</p>
<ul class="simple">
<li><a class="reference internal" href="ref/contrib/admin/index.html"><em>Admin site</em></a></li>
<li><a class="reference internal" href="ref/contrib/admin/actions.html"><em>Admin actions</em></a></li>
<li><a class="reference internal" href="ref/contrib/admin/admindocs.html"><em>Admin documentation generator</em></a></li>
</ul>
</div>
<div class="section" id="s-security">
<span id="security"></span><h2>Security<a class="headerlink" href="#security" title="Permalink to this headline">¶</a></h2>
<p>Security is a topic of paramount importance in the development of Web
applications and Django provides multiple protection tools and mechanisms:</p>
<ul class="simple">
<li><a class="reference internal" href="topics/security.html"><em>Security overview</em></a></li>
<li><a class="reference internal" href="releases/security.html"><em>Disclosed security issues in Django</em></a></li>
<li><a class="reference internal" href="ref/clickjacking.html"><em>Clickjacking protection</em></a></li>
<li><a class="reference internal" href="ref/contrib/csrf.html"><em>Cross Site Request Forgery protection</em></a></li>
<li><a class="reference internal" href="topics/signing.html"><em>Cryptographic signing</em></a></li>
</ul>
</div>
<div class="section" id="s-internationalization-and-localization">
<span id="internationalization-and-localization"></span><h2>Internationalization and localization<a class="headerlink" href="#internationalization-and-localization" title="Permalink to this headline">¶</a></h2>
<p>Django offers a robust internationalization and localization framework to
assist you in the development of applications for multiple languages and world
regions:</p>
<ul class="simple">
<li><a class="reference internal" href="topics/i18n/index.html"><em>Overview</em></a> |
<a class="reference internal" href="topics/i18n/translation.html"><em>Internationalization</em></a> |
<a class="reference internal" href="topics/i18n/translation.html#how-to-create-language-files"><em>Localization</em></a> |
<a class="reference internal" href="topics/i18n/formatting.html"><em>Localized Web UI formatting and form input</em></a></li>
<li><a class="reference internal" href="topics/localflavor.html"><em>&#8220;Local flavor&#8221;</em></a></li>
<li><a class="reference internal" href="topics/i18n/timezones.html"><em>Time zones</em></a></li>
</ul>
</div>
<div class="section" id="s-performance-and-optimization">
<span id="performance-and-optimization"></span><h2>Performance and optimization<a class="headerlink" href="#performance-and-optimization" title="Permalink to this headline">¶</a></h2>
<p>There are a variety of techniques and tools that can help get your code running
more efficiently - faster, and using fewer system resources.</p>
<ul class="simple">
<li><a class="reference internal" href="topics/performance.html"><em>Performance and optimization overview</em></a></li>
</ul>
</div>
<div class="section" id="s-python-compatibility">
<span id="python-compatibility"></span><h2>Python compatibility<a class="headerlink" href="#python-compatibility" title="Permalink to this headline">¶</a></h2>
<p>Django aims to be compatible with multiple different flavors and versions of
Python:</p>
<ul class="simple">
<li><a class="reference internal" href="howto/jython.html"><em>Jython support</em></a></li>
<li><a class="reference internal" href="topics/python3.html"><em>Python 3 compatibility</em></a></li>
</ul>
</div>
<div class="section" id="s-geographic-framework">
<span id="geographic-framework"></span><h2>Geographic framework<a class="headerlink" href="#geographic-framework" title="Permalink to this headline">¶</a></h2>
<p><a class="reference internal" href="ref/contrib/gis/index.html"><em>GeoDjango</em></a> intends to be a world-class geographic
Web framework. Its goal is to make it as easy as possible to build GIS Web
applications and harness the power of spatially enabled data.</p>
</div>
<div class="section" id="s-common-web-application-tools">
<span id="common-web-application-tools"></span><h2>Common Web application tools<a class="headerlink" href="#common-web-application-tools" title="Permalink to this headline">¶</a></h2>
<p>Django offers multiple tools commonly needed in the development of Web
applications:</p>
<ul class="simple">
<li><a class="reference internal" href="topics/auth/index.html"><em>Authentication</em></a></li>
<li><a class="reference internal" href="topics/cache.html"><em>Caching</em></a></li>
<li><a class="reference internal" href="topics/logging.html"><em>Logging</em></a></li>
<li><a class="reference internal" href="topics/email.html"><em>Sending emails</em></a></li>
<li><a class="reference internal" href="ref/contrib/syndication.html"><em>Syndication feeds (RSS/Atom)</em></a></li>
<li><a class="reference internal" href="topics/pagination.html"><em>Pagination</em></a></li>
<li><a class="reference internal" href="ref/contrib/messages.html"><em>Messages framework</em></a></li>
<li><a class="reference internal" href="topics/serialization.html"><em>Serialization</em></a></li>
<li><a class="reference internal" href="topics/http/sessions.html"><em>Sessions</em></a></li>
<li><a class="reference internal" href="ref/contrib/sitemaps.html"><em>Sitemaps</em></a></li>
<li><a class="reference internal" href="ref/contrib/staticfiles.html"><em>Static files management</em></a></li>
<li><a class="reference internal" href="ref/validators.html"><em>Data validation</em></a></li>
</ul>
</div>
<div class="section" id="s-other-core-functionalities">
<span id="other-core-functionalities"></span><h2>Other core functionalities<a class="headerlink" href="#other-core-functionalities" title="Permalink to this headline">¶</a></h2>
<p>Learn about some other core functionalities of the Django framework:</p>
<ul class="simple">
<li><a class="reference internal" href="topics/conditional-view-processing.html"><em>Conditional content processing</em></a></li>
<li><a class="reference internal" href="ref/contrib/contenttypes.html"><em>Content types and generic relations</em></a></li>
<li><a class="reference internal" href="ref/contrib/flatpages.html"><em>Flatpages</em></a></li>
<li><a class="reference internal" href="ref/contrib/redirects.html"><em>Redirects</em></a></li>
<li><a class="reference internal" href="topics/signals.html"><em>Signals</em></a></li>
<li><a class="reference internal" href="topics/checks.html"><em>System check framework</em></a></li>
<li><a class="reference internal" href="ref/contrib/sites.html"><em>The sites framework</em></a></li>
<li><a class="reference internal" href="ref/unicode.html"><em>Unicode in Django</em></a></li>
</ul>
</div>
<div class="section" id="s-the-django-open-source-project">
<span id="the-django-open-source-project"></span><h2>The Django open-source project<a class="headerlink" href="#the-django-open-source-project" title="Permalink to this headline">¶</a></h2>
<p>Learn about the development process for the Django project itself and about how
you can contribute:</p>
<ul class="simple">
<li><strong>Community:</strong>
<a class="reference internal" href="internals/contributing/index.html"><em>How to get involved</em></a> |
<a class="reference internal" href="internals/release-process.html"><em>The release process</em></a> |
<a class="reference internal" href="internals/committers.html"><em>Team of committers</em></a> |
<a class="reference internal" href="internals/git.html"><em>The Django source code repository</em></a> |
<a class="reference internal" href="internals/security.html"><em>Security policies</em></a> |
<a class="reference internal" href="internals/mailing-lists.html"><em>Mailing lists</em></a></li>
<li><strong>Design philosophies:</strong>
<a class="reference internal" href="misc/design-philosophies.html"><em>Overview</em></a></li>
<li><strong>Documentation:</strong>
<a class="reference internal" href="internals/contributing/writing-documentation.html"><em>About this documentation</em></a></li>
<li><strong>Third-party distributions:</strong>
<a class="reference internal" href="misc/distributions.html"><em>Overview</em></a></li>
<li><strong>Django over time:</strong>
<a class="reference internal" href="misc/api-stability.html"><em>API stability</em></a> |
<a class="reference internal" href="releases/index.html"><em>Release notes and upgrading instructions</em></a> |
<a class="reference internal" href="internals/deprecation.html"><em>Deprecation Timeline</em></a></li>
</ul>
</div>
</div>


          </div>
        </div>
      </div>
      
        
      
    </div>

    <div id="ft">
      <div class="nav">
    &laquo; <a href="contents.html" title="Django documentation contents">previous</a>
     |
    <a title="Django 1.7.8.dev20150401230226 documentation" href="#" accesskey="U">up</a>
   |
    <a href="intro/index.html" title="Getting started">next</a> &raquo;</div>
    </div>
  </div>

      <div class="clearer"></div>
    </div>
  </body>
</html>